package com.zhang.crm.handler;

import com.zhang.crm.result.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常的捕获
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler
    public R handlerException(Exception e) {
        e.printStackTrace();
        return R.FAIL("操作失败，原因是：" + e.getLocalizedMessage());
    }
}
